
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.filechooser.FileNameExtensionFilter;

public class ClassNotes extends javax.swing.JFrame {

    private ChatManager chatManager;
    private ChatWatcher watcher;
    private LoginManager loginManager;
    private ChatFile selectedChat;
    private static JFileChooser chooser;
    private ChatFormattingForm chatFormattingForm = new ChatFormattingForm(this);

    // initialize look and feel to the current system's -- this makes the app
    // look far more like notepad on windows systems
    static {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception ex) {
            // not a big deal, the app will just use the ugly default theme
        }
    }

    // initialize the JFileChooser to the correct directory
    static {
        String dir = null;
        try {
            // try to get the location of this class's directory
            File classPath = getClassDir();
            dir = classPath.getParent();
        } catch (Exception ex) {
            // Use working directory instead
            ex.printStackTrace();
            dir = System.getProperty("user.dir");
        } finally {
            chooser = new JFileChooser(dir);
        }
    }

    public ClassNotes() {
        initComponents();
        initFakeChooser();
        try {
            BufferedImage icon = ImageIO.read(this.getClass().getResource("notepad.gif"));
            setIconImage(icon);
        } catch (IOException e) {
            e.printStackTrace();
        }

        chatManager = new ChatManager(chatTextArea);
        watcher = new ChatWatcher(chatManager);
        loginManager = new LoginManager(chatManager);
    }

    @Override
    public void setVisible(boolean b) {
        super.setVisible(b);
        // NetBeans complains about starting a thread in the constructor,
        // so I do it here instead.
        if (b) {
            watcher.start();
        } else {
            watcher.interrupt();
        }
    }

    public static File getClassDir() {
        try {
            return new File(ClassNotes.class.getResource("ClassNotes.class").toURI());
        } catch (Exception e) {
            // this one is pretty much impossible
            e.printStackTrace();
            return null;
        }
    }

    private void initFakeChooser() {
        FileNameExtensionFilter txtFilter =
                new FileNameExtensionFilter("Text File", "txt");
        chooser.setFileFilter(txtFilter);
        chooser.setAcceptAllFileFilterUsed(false);
        if (chooser.getChoosableFileFilters().length>2)
        {
            chooser.removeChoosableFileFilter(chooser.getChoosableFileFilters()[1]);
            chooser.removeChoosableFileFilter(chooser.getChoosableFileFilters()[1]);
        }
    }

    private void initRealChooser() {
        // set directory to chat folder
        chooser.setCurrentDirectory(new File("S:/projects/programmingclub/src/notes/more/more.../chats"));
        FileNameExtensionFilter chtFilter =
                new FileNameExtensionFilter("Chat File", "cht");
        chooser.setAcceptAllFileFilterUsed(true);
        chooser.setFileFilter(chtFilter);
    }

    private void addChat(ChatFile chat) {
        showFakeError(null); // only displayed if user not logged in
        selectedChat = chat;
        chatManager.addChat(chat);
        JMenuItem item = new JMenuItem(chat.getNameNoExtension());
        item.setActionCommand(chat.getAbsolutePath());
        item.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                viewMenuClicked(e);
            }
        });
        viewMenu.add(item);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        chatScrollPane = new javax.swing.JScrollPane();
        chatPanel = new javax.swing.JPanel();
        chatTextArea = new javax.swing.JTextArea();
        entryTextArea = new javax.swing.JTextArea();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        menuItemNew = new javax.swing.JMenuItem();
        menuItemOpen = new javax.swing.JMenuItem();
        menuItemSave = new javax.swing.JMenuItem();
        menuItemSaveAs = new javax.swing.JMenuItem();
        fileMenuSeparator1 = new javax.swing.JPopupMenu.Separator();
        menuItemPageSetup = new javax.swing.JMenuItem();
        menuItemPrint = new javax.swing.JMenuItem();
        fileMenuSeparator2 = new javax.swing.JPopupMenu.Separator();
        menuItemExit = new javax.swing.JMenuItem();
        editMenu = new javax.swing.JMenu();
        menuItemUndo = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        menuItemCut = new javax.swing.JMenuItem();
        menuItemCopy = new javax.swing.JMenuItem();
        menuItemPaste = new javax.swing.JMenuItem();
        menuItemDelete = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        menuItemFind = new javax.swing.JMenuItem();
        menuItemFindNext = new javax.swing.JMenuItem();
        menuItemReplace = new javax.swing.JMenuItem();
        menuItemGoTo = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        menuItemSelectAll = new javax.swing.JMenuItem();
        menuItemTimeDate = new javax.swing.JMenuItem();
        formatMenu = new javax.swing.JMenu();
        menuItemWordWrap = new javax.swing.JMenuItem();
        menuItemFont = new javax.swing.JMenuItem();
        viewMenu = new javax.swing.JMenu();
        menuItemStatusBar = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        menuItemViewHelp = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        menuItemAbout = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Notepad");

        chatScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        chatScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        chatPanel.setLayout(new java.awt.BorderLayout());

        chatTextArea.setColumns(20);
        chatTextArea.setEditable(false);
        chatTextArea.setFont(new java.awt.Font("Lucida Console", 0, 13));
        chatTextArea.setLineWrap(true);
        chatTextArea.setWrapStyleWord(true);
        chatPanel.add(chatTextArea, java.awt.BorderLayout.PAGE_START);

        entryTextArea.setColumns(20);
        entryTextArea.setFont(new java.awt.Font("Lucida Console", 0, 13));
        entryTextArea.setLineWrap(true);
        entryTextArea.setWrapStyleWord(true);
        entryTextArea.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                entryTextAreaKeyTyped(evt);
            }
        });
        chatPanel.add(entryTextArea, java.awt.BorderLayout.CENTER);

        chatScrollPane.setViewportView(chatPanel);

        fileMenu.setText("File");

        menuItemNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        menuItemNew.setText("New");
        menuItemNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemNewActionPerformed(evt);
            }
        });
        fileMenu.add(menuItemNew);

        menuItemOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        menuItemOpen.setText("Open...");
        menuItemOpen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemOpenActionPerformed(evt);
            }
        });
        fileMenu.add(menuItemOpen);

        menuItemSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        menuItemSave.setText("Save");
        fileMenu.add(menuItemSave);

        menuItemSaveAs.setText("Save As...");
        menuItemSaveAs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        fileMenu.add(menuItemSaveAs);
        fileMenu.add(fileMenuSeparator1);

        menuItemPageSetup.setText("Page Setup...");
        menuItemPageSetup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        fileMenu.add(menuItemPageSetup);

        menuItemPrint.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        menuItemPrint.setText("Print...");
        menuItemPrint.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        fileMenu.add(menuItemPrint);
        fileMenu.add(fileMenuSeparator2);

        menuItemExit.setText("Exit");
        menuItemExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemExitActionPerformed(evt);
            }
        });
        fileMenu.add(menuItemExit);

        menuBar.add(fileMenu);

        editMenu.setText("Edit");

        menuItemUndo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, java.awt.event.InputEvent.CTRL_MASK));
        menuItemUndo.setText("Undo");
        menuItemUndo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemUndo);
        editMenu.add(jSeparator1);

        menuItemCut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        menuItemCut.setText("Cut");
        menuItemCut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemCut);

        menuItemCopy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        menuItemCopy.setText("Copy");
        menuItemCopy.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemCopy);

        menuItemPaste.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        menuItemPaste.setText("Paste");
        menuItemPaste.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemPaste);

        menuItemDelete.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DELETE, 0));
        menuItemDelete.setText("Delete");
        menuItemDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemDelete);
        editMenu.add(jSeparator2);

        menuItemFind.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK));
        menuItemFind.setText("Find...");
        menuItemFind.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemFind);

        menuItemFindNext.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F3, 0));
        menuItemFindNext.setText("Find Next");
        menuItemFindNext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemFindNext);

        menuItemReplace.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        menuItemReplace.setText("Replace...");
        editMenu.add(menuItemReplace);

        menuItemGoTo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.CTRL_MASK));
        menuItemGoTo.setText("Go To...");
        menuItemGoTo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemGoTo);
        editMenu.add(jSeparator3);

        menuItemSelectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        menuItemSelectAll.setText("Select All");
        menuItemSelectAll.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemSelectAll);

        menuItemTimeDate.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        menuItemTimeDate.setText("Time/Date");
        menuItemTimeDate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        editMenu.add(menuItemTimeDate);

        menuBar.add(editMenu);

        formatMenu.setText("<HTML>Format</HTML>");

        menuItemWordWrap.setText("Word Wrap");
        menuItemWordWrap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        formatMenu.add(menuItemWordWrap);

        menuItemFont.setText("Font...");
        menuItemFont.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemFontActionPerformed(evt);
            }
        });
        formatMenu.add(menuItemFont);

        menuBar.add(formatMenu);

        viewMenu.setText("View");
        viewMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });

        menuItemStatusBar.setText("Status Bar");
        menuItemStatusBar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        viewMenu.add(menuItemStatusBar);

        menuBar.add(viewMenu);

        helpMenu.setText("Help");

        menuItemViewHelp.setText("View Help");
        menuItemViewHelp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFakeError(evt);
            }
        });
        helpMenu.add(menuItemViewHelp);
        helpMenu.add(jSeparator4);

        menuItemAbout.setText("About Notepad");
        helpMenu.add(menuItemAbout);

        menuBar.add(helpMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(chatScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 572, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(chatScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuItemNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemNewActionPerformed
        int success = chooser.showSaveDialog(this);
        if (success == JFileChooser.APPROVE_OPTION) {
            File selected = chooser.getSelectedFile();

            String path = selected.getPath();
            if (path.endsWith(ChatManager.FILE_EXTENSION) == false) {
                path += ChatManager.FILE_EXTENSION;
                selected = new File(path);
                System.out.println("extended");
            }

            if (selected.exists()) {
                JOptionPane.showMessageDialog(this,
                        "That chatroom already exists. Choose another name.",
                        "Problem?",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }

            try {
                selectedChat = chatManager.createChatroom(selected);
                addChat(selectedChat);
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this,
                        "Uh oh. An error occurred, your chatroom could not be created.",
                        "What happened?",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_menuItemNewActionPerformed

    private void menuItemOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemOpenActionPerformed

        int success = chooser.showOpenDialog(this);
        if (success == JFileChooser.APPROVE_OPTION) {
            File f = chooser.getSelectedFile();
            if (f.exists()) {
                addChat(new ChatFile(f));
            }
            if (!loginManager.isLoggedIn()) {
                JOptionPane.showMessageDialog(this,
                        "An error occurred while opening the specified file.",
                        "Error",
                        JOptionPane.ERROR_MESSAGE);
            }
        }

    }//GEN-LAST:event_menuItemOpenActionPerformed
public void clearIdleUsers()
    {
    try{
    for(int i=0; i<loginManager.userFile.getText().split("\\n").length; i++ )
                        {


                        if(Long.valueOf(loginManager.loginString.split(",")[1].substring(0,loginManager.loginString.split(",")[1].length()-2))-Long.valueOf(loginManager.userFile.getText().split("\\n")[i].split(",")[1].substring(0,loginManager.userFile.getText().split("\\n")[i].split(",")[1].length()- 1))>5000)
                        {
                                                        loginManager.userFile.reWriteUsers(loginManager.userFile.getText(), loginManager.userFile.getText().split("\\n")[i]+"\n", "");
                        }

                            }
                        } catch (IOException ex) {
                            ex.printStackTrace();
                        }

}
    private void entryTextAreaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_entryTextAreaKeyTyped
        // only submit if enter was pressed
        if (evt.getKeyChar() == '\n' && !evt.isShiftDown()) {
            String msg = entryTextArea.getText();
            // remove last character (a newline because user pressed enter)
            msg = msg.substring(0, msg.length() - 1);

            String reply = null;
            if (loginManager.isLoggedIn() == false) {
                try {
                    reply = loginManager.check(msg.split("\\r?\\n")[msg.split("\\r?\\n").length - 1]);
                } catch (ArrayIndexOutOfBoundsException ob) {
                    //nobody cares
                }
                if (reply != null) {
                    chatTextArea.setText(reply);
                    if (loginManager.isLoggedIn()) {
                        initRealChooser();
                    }
                    entryTextArea.setText(null);
                }
            } else {
                // the user must have opened or created a chatroom
                if (selectedChat != null) {
                    // don't let them enter an empty string
                    if (msg.isEmpty() == false) {
                        chatManager.sendMessage(selectedChat, msg);
                        try {
loginManager.userFile.reWriteUsers(loginManager.userFile.getText(),loginManager.loginString,
loginManager.setLoginString(chatManager.getUsername()+','+String.valueOf(System.currentTimeMillis())+'\n'));
                        clearIdleUsers();
                    } catch (IOException ex) {
                            ex.printStackTrace();
                        }
                    }
                } else {
                    chatTextArea.setText("You need to open a chatroom first. Use the file menu above.");
                }

                entryTextArea.setText(null);
            }
        }
    }//GEN-LAST:event_entryTextAreaKeyTyped

    private void menuItemExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemExitActionPerformed
        if (!loginManager.isLoggedIn()) {
            System.exit(0);
        } else {
            try {
                logout();
            } catch (IOException ex) {
                System.out.println("Sad faec...");
            }
        }
    }//GEN-LAST:event_menuItemExitActionPerformed

    public void logout() throws IOException {
        loginManager.userFile.reWriteUsers(loginManager.userFile.getText(), loginManager.loginString, "");
        loginManager.setLoggedIn(false);
        chatManager.setUsername("");
        viewMenu.removeAll();
        viewMenu.add(menuItemStatusBar);
        chatTextArea.setText(null);
        initFakeChooser();
    }
    private void showFakeError(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showFakeError
        // we don't want to annoy logged in users by showing them errors
        if (loginManager.isLoggedIn() == false) {
            // the error message message should scare people away, but not
            // enough to have them tell an administrator
            JOptionPane.showMessageDialog(this,
                    "This application has performed an illegal operation and will be shut down.",
                    "Illegal operation",
                    JOptionPane.ERROR_MESSAGE);
            System.exit(0);
        }
    }//GEN-LAST:event_showFakeError

    private void menuItemFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemFontActionPerformed
        showFakeError(null);
        chatFormattingForm.setFilter(chatManager.getChatFilter());
        ChatFilter filter = chatFormattingForm.showDialog();
        chatManager.setChatFilter(filter);
    }//GEN-LAST:event_menuItemFontActionPerformed

    private void viewMenuClicked(ActionEvent e) {
        String path = e.getActionCommand();
        Iterator openChats = chatManager.getOpenChats().iterator();
        while (openChats.hasNext()) {
            ChatFile chat = (ChatFile) openChats.next();
            if (path.equals(chat.getAbsolutePath())) {
                selectedChat = chat;
                chatManager.update(chat);
                return;
            }
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel chatPanel;
    private javax.swing.JScrollPane chatScrollPane;
    private javax.swing.JTextArea chatTextArea;
    private javax.swing.JMenu editMenu;
    private javax.swing.JTextArea entryTextArea;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JPopupMenu.Separator fileMenuSeparator1;
    private javax.swing.JPopupMenu.Separator fileMenuSeparator2;
    private javax.swing.JMenu formatMenu;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem menuItemAbout;
    private javax.swing.JMenuItem menuItemCopy;
    private javax.swing.JMenuItem menuItemCut;
    private javax.swing.JMenuItem menuItemDelete;
    private javax.swing.JMenuItem menuItemExit;
    private javax.swing.JMenuItem menuItemFind;
    private javax.swing.JMenuItem menuItemFindNext;
    private javax.swing.JMenuItem menuItemFont;
    private javax.swing.JMenuItem menuItemGoTo;
    private javax.swing.JMenuItem menuItemNew;
    private javax.swing.JMenuItem menuItemOpen;
    private javax.swing.JMenuItem menuItemPageSetup;
    private javax.swing.JMenuItem menuItemPaste;
    private javax.swing.JMenuItem menuItemPrint;
    private javax.swing.JMenuItem menuItemReplace;
    private javax.swing.JMenuItem menuItemSave;
    private javax.swing.JMenuItem menuItemSaveAs;
    private javax.swing.JMenuItem menuItemSelectAll;
    private javax.swing.JMenuItem menuItemStatusBar;
    private javax.swing.JMenuItem menuItemTimeDate;
    private javax.swing.JMenuItem menuItemUndo;
    private javax.swing.JMenuItem menuItemViewHelp;
    private javax.swing.JMenuItem menuItemWordWrap;
    private javax.swing.JMenu viewMenu;
    // End of variables declaration//GEN-END:variables

    public static void main(String args[]) {
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                new ClassNotes().setVisible(true);

            }
        });
    }
}
